package model;

//hangyasza a gameobjectbol szarmaztatva
public class AntOdor extends GameObject{
	protected float range;
	protected int ownerID;
	protected boolean isAlive=true;
	//alapkonstruktor
	AntOdor(Game currgame){
		super(currgame,"AntOdor");
		range=10.0f;
	}
	
	//szag felszivodasa
	public boolean dissipate(){
		range=(range - 0.125f);
		//ha a hatosugar 0.5 ala csokken akkor a szag megszunik
		if(range<=0.0f){
			isAlive=false;
			this.game.gameObjects.remove(this);
			return true;
		}
		return false;
	}
	//a szag megsemmisul, eltavolitjuk a gameobjects listabol
	public void killOdor(){
		isAlive=false;
		this.game.gameObjects.remove(this);
	}
	
	//szagsemlegesito spray hatokoreben van-e
	boolean collision(AntOdorKillerSpray p) {
		if(this.loc_x>p.loc_x-p.range && this.loc_x<p.loc_x+p.range && this.loc_y>p.loc_y-p.range && this.loc_y<p.loc_y+p.range){
			//ha igen akkor eltavolitjuk
			return true;
		}
		return false;
	}
	public int getOwnerID() {
		return ownerID;
	}
	public void setOwnerID(int ownerID) {
		this.ownerID = ownerID;
	}
	
	public boolean getisAlive(){
		return isAlive;
	}
	
	public float getRange(){
		return range;
	}
}
